import Layout from '../components/Layout'
/*

hidden:true隐藏路由
alwaysShow:true 当路由下面的children只有一个时将路由提前，不显示当前路由
*/

const routes = [
  {
    path: '/',
    component: Layout,
    meta: {
      title: '默认首页'
    },
    alwaysShow: true,
    redirect: '/home',
    children: [
      {
        path: 'home',
        meta: {
          title: '首页'
        },
        component: () => import('../views')
      }

    ]
  },
  {
    path: '/system',
    meta: {
      title: '系统管理'
    },
    component: Layout
  },
  {
    path: '/user',
    meta: {
      title: '用户管理',
      icon: 'el-icon-user'
    },
    alwaysShow: true,
    children: [
      {
        path: 'list',
        meta: {
          title: '用户管理',
          icon: 'el-icon-menu'
        },
        component: () => import('../views/users/index')
      }
    ],
    component: Layout

  },
  {
    path: '/role',
    component: Layout,
    meta: {
      title: '角色管理',
      icon: 'el-icon-user-solid'
    },
    alwaysShow: true,

    children: [
      {
        path: 'roles',
        meta: {
          title: '角色管理',
          icon: 'el-icon-user-solid'
        }
        // component: () => import('../views/rolemanage')
      }
    ]

  },
  {
    path: '/content',
    meta: {
      title: '文章管理',
      icon: 'el-icon-s-operation'
    },
    component: Layout,
    children: [
      {
        path: 'list',
        meta: {
          title: '文章列表',
          icon: 'el-icon-document'
        },
        component: () => import('../views/article/homs')
      },
      {
        path: 'classify',
        meta: {
          title: '文章栏目',
          icon: 'el-icon-c-scale-to-original'
        },
        component: () => import('../views/article/column')
      },
      {
        path: 'add',
        meta: {
          title: '添加文章',
          icon: 'el-icon-edit-outline'
        },
        component: () => import('../views/article/addarticle')
      }
    ]
  },
  {
    path: '/images',
    component: Layout,
    meta: {
      title: '图片管理',
      icon: 'el-icon-picture'
    },
    alwaysShow: true,
    children: [
      {
        path: 'picture',
        meta: {
          title: '图片管理',
          icon: 'el-icon-picture'
        },
        component: () => import('../views/users/picture')
        // component: () => import('../views/login')
      }
    ]

  },
  {
    path: '/about',
    meta: {
      title: '关于我们'
    },
    component: Layout
  },

  //   这个路由一定要放在最后，匹配不到上面的路由，就匹配404路由
  {
    path: '*',
    hidden: true, // 隐藏路由
    meta: {
      title: '404错误'
    },
    component: () => import('../views/error/404')
  }

]

export default routes
